package com.changgou.seckill;

import com.changgou.seckill.task.MultiThreadingCreateOrder;
import entity.IdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import tk.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.scheduling.annotation.EnableScheduling;


/**
 * @ClassName SecKillApplication
 * @Description 秒杀启动类
 * @Author Mr.L
 * @Date 20:27 2019/11/27
 * @Version 2.1
 **/
@SpringBootApplication
@EnableEurekaClient
@MapperScan(basePackages = {"com.changgou.seckill.dao"})
@EnableScheduling       // 开始定时任务
@EnableAsync            // 开始异步执行
public class SecKillApplication {
    public static void main(String[] args) {
        SpringApplication.run(SecKillApplication.class, args);
    }

    @Bean
    public IdWorker idWorker(){
        return new IdWorker(1,1);
    }

    @Bean
    public MultiThreadingCreateOrder multiThreadingCreateOrder(){
        return new MultiThreadingCreateOrder();
    }

}
